<template>
  <div class="invitationPageComponent" v-if="oItem">
    <div
      class="content"
      :style="{ backgroundImage: 'url(' + oItem.main.invitationPageBgImg + ')' }"
    >
        <div class="qrcode" v-if="oItem.main.invitationPageQrCodeImg" :style="{
          left:oItem.main.offsetLeftAndRight+'%',
          top:oItem.main.offsetUpAndDown+'%',
        }">
            <img :src="oItem.main.invitationPageQrCodeImg" alt="">
        </div>
    </div>
  </div>
</template>
<script>
import Bus from "@/utils/bus";
import { mapState } from "vuex";
export default {
  name: "invitationPageComponent",
  data() {
    return {
      oItem: null,
    };
  },
  created() {},
  props: ["item", "ename", "id"],
  components: {},
  mounted() {
    this.$nextTick(() => {
      this.init();
    });
    const emitName = this.ename + this.id;
    Bus.$off(emitName);
    Bus.$on(emitName, (control) => {
      this.oItem = null;
      this.$nextTick(() => {
        this.oItem = JSON.parse(control);
      });
    });
  },
  methods: {
    //页面初始化
    init() {
      // //console.log("进入init");
      this.oItem = null;
      this.oItem = JSON.parse(JSON.stringify(this.item));
    },
  },
  computed: mapState(["decorate"]),
  watch: {},
};
</script>
<style scoped lang="scss">
.invitationPageComponent {
  height: 100%;
  .content {
    height: 100%;
    min-height: 617px;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    position: relative;
    .qrcode{
        position: absolute;top:50%;left:50%;z-index: 2;transform: translate(-50%,-50%);
        width:150px;height:150px;
        img{width:100%;height:100%;display: block;}
    }
  }
}
</style>
